From: Ian Campbell Date: Tue, 24 May 2011 16:12:27 +0000 (+0100) Subject: libxl: libxl__xs_write format string should be const. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~10315 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=048e71cd85e5ab1a91c60a53745c7706004cf3d0;p=xen.git libxl: libxl__xs_write format string should be const. George Dunlap reports that gcc 4.4.3 complains: libxl_dm.c: In function libxl__create_device_mode: libxl_dm.c:776: error: format not a string literal and no format arguments And indeed the format argument here is a char * from libxl__domain_bios(). Make the argument to libxl__xs_write a const char * and change libxl__domain_bios to return a const char too. Signed-off-by: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Jackson --- diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 7a81cbfe26..1ba7fe5b5e 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -68,12 +68,12 @@ const char *libxl__domain_device_model(libxl__gc *gc, return dm; } -static char *libxl__domain_bios(libxl__gc *gc, +static const char *libxl__domain_bios(libxl__gc *gc, libxl_device_model_info *info) { switch (info->device_model_version) { - case 1: return libxl__strdup(gc, "rombios"); - case 2: return libxl__strdup(gc, "seabios"); + case 1: return "rombios"; + case 2: return "seabios"; default:return NULL; } } diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 8d25ef48a2..b032e7fa8e 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -153,7 +153,7 @@ _hidden char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, int _hidden int libxl__xs_writev(libxl__gc *gc, xs_transaction_t t, char *dir, char **kvs); _hidden int libxl__xs_write(libxl__gc *gc, xs_transaction_t t, - char *path, char *fmt, ...) PRINTF_ATTRIBUTE(4, 5); + char *path, const char *fmt, ...) PRINTF_ATTRIBUTE(4, 5); /* Each fn returns 0 on success. * On error: returns -1, sets errno (no logging) */ diff --git a/tools/libxl/libxl_xshelp.c b/tools/libxl/libxl_xshelp.c index 3dc9239bcb..1df377c707 100644 --- a/tools/libxl/libxl_xshelp.c +++ b/tools/libxl/libxl_xshelp.c @@ -69,7 +69,7 @@ int libxl__xs_writev(libxl__gc *gc, xs_transaction_t t, } int libxl__xs_write(libxl__gc *gc, xs_transaction_t t, - char *path, char *fmt, ...) + char *path, const char *fmt, ...) { libxl_ctx *ctx = libxl__gc_owner(gc); char *s;